package org.road0329.tools.proto_parse_tool.component;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class Dictionary {

    public static final Map<String, String> DICT = new HashMap<>();

    public static void init() {
        try {
            ClassLoader classLoader = Dictionary.class.getClassLoader();
            InputStream inputStream = classLoader.getResourceAsStream("dictionary.properties");
            Properties properties = new Properties();
            properties.load(inputStream);
            for (String key : properties.stringPropertyNames()) {
                String value = properties.getProperty(key);
                DICT.put("\"" + key + "\"", "\"" + value + "\"");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}